package com.puny.utils
{
	import flash.geom.Point;
	
	public class RoundWallGenerator extends DisplacementMapGenerator
	{
		public function RoundWallGenerator(width:Number,height:Number) {
			super(width,height);
		}
		
		override protected function calcurate(xdd:Number,ydd:Number):Point {
			var th:Number = Math.PI / 8;
			var d:Number = 100;
			var l:Number = width * 1.25;
			var xd:Number;
			var yd:Number;
			var zd:Number;
			var zdd:Number;
			var x_:Number;
			var y_:Number;
			xd = xdd;
			x_ = l * Math.asin(xd/l);
			zd = l - l * Math.cos(x_/l);
			zdd = (zd + ydd * Math.sin(th) + d * (1 - Math.cos(th))) * Math.cos(th);
			yd = ydd * Math.cos(th) + zdd * Math.sin(th) - d * Math.sin(th);
			y_ = yd;
			return new Point(x_,y_);			
		}
		
		
	}
}